<?php
namespace proxy;

use core\model\Model;
use core\proxy\DaemonProxy;
use Exception;
use modules\home\model\UserModel;
use ReflectionClass;
use ReflectionMethod;

class DoBeforeQuery implements DaemonProxy {

    public function getSort() {
        return 0;
    }

    function matchClass(ReflectionClass $class) : bool
    {
        return $class->isSubclassOf( Model::class);
    }

    function matchMethod(ReflectionMethod $method) : bool
    {
        return false;
//        return $method->getName() != 'testThrow';
    }

    function doBefore($args, ReflectionClass $class, ReflectionMethod $method)
    {
        var_dump(__CLASS__.__METHOD__);
    }

    function doAfter()
    {
        var_dump(__CLASS__.__METHOD__);
    }

    function doThrow(Exception $e)
    {
        var_dump(__CLASS__.__METHOD__);
    }

    function doFinally()
    {
        var_dump(__CLASS__.__METHOD__);
    }

    function doBeforeReturn($o)
    {
        var_dump(__CLASS__.__METHOD__);
    }
}